/// id : 3907
/// name : "aaa"
/// subject : "bbbbbb"
/// content : "<p>阿三大苏打实打实的</p><p>You are receiving this email because you opted in via our website <a href=''></a>.\n         if you do not want to receive these emails，please feel free to <a href='https://ecamp.pintreel.com/newsletter-registration/%e9%80%80%e8%ae%a2/'>unsubscribe</a>.</p>"
/// attachments : [{"name":"comandroidcamera2_Screenshot_20220811_144229.png","url":"https://file.pintreel.com/api/media/medias/c283d58a813bcd84fb08f224e0144875","size":"16210","uid":1690955968826,"status":"success"}]
/// user_id : 1409
/// sub_user : null
/// created_at : "2023-08-02 13:59:06"
/// updated_at : "2023-08-02 13:59:33"
/// schedule_count : 0

class EmailMessageModel {
  EmailMessageModel({
    int? id,
    String? name,
    String? subject,
    String? content,
    List<AttachmentsModel>? attachments,
    int? userId,
    dynamic subUser,
    String? createdAt,
    String? updatedAt,
    int? scheduleCount,
  }) {
    _id = id;
    _name = name;
    _subject = subject;
    _content = content;
    _attachments = attachments;
    _userId = userId;
    _subUser = subUser;
    _createdAt = createdAt;
    _updatedAt = updatedAt;
    _scheduleCount = scheduleCount;
  }

  EmailMessageModel.fromJson(dynamic json) {
    _id = json['id'];
    _name = json['name'];
    _subject = json['subject'];
    _content = json['content'];
    if (json['attachments'] != null) {
      _attachments = [];
      json['attachments'].forEach((v) {
        _attachments?.add(AttachmentsModel.fromJson(v));
      });
    }
    _userId = json['user_id'];
    _subUser = json['sub_user'];
    _createdAt = json['created_at'];
    _updatedAt = json['updated_at'];
    _scheduleCount = json['schedule_count'];
  }
  int? _id;
  String? _name;
  String? _subject;
  String? _content;
  List<AttachmentsModel>? _attachments;
  int? _userId;
  dynamic _subUser;
  String? _createdAt;
  String? _updatedAt;
  int? _scheduleCount;
  bool check = false;

  EmailMessageModel copyWith({
    int? id,
    String? name,
    String? subject,
    String? content,
    List<AttachmentsModel>? attachments,
    int? userId,
    dynamic subUser,
    String? createdAt,
    String? updatedAt,
    int? scheduleCount,
  }) =>
      EmailMessageModel(
        id: id ?? _id,
        name: name ?? _name,
        subject: subject ?? _subject,
        content: content ?? _content,
        attachments: attachments ?? _attachments,
        userId: userId ?? _userId,
        subUser: subUser ?? _subUser,
        createdAt: createdAt ?? _createdAt,
        updatedAt: updatedAt ?? _updatedAt,
        scheduleCount: scheduleCount ?? _scheduleCount,
      );
  int? get id => _id;
  String? get name => _name;
  String? get subject => _subject;
  String? get content => _content;
  List<AttachmentsModel>? get attachments => _attachments;
  int? get userId => _userId;
  dynamic get subUser => _subUser;
  String? get createdAt => _createdAt;
  String? get updatedAt => _updatedAt;
  int? get scheduleCount => _scheduleCount;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = _id;
    map['name'] = _name;
    map['subject'] = _subject;
    map['content'] = _content;
    if (_attachments != null) {
      map['attachments'] = _attachments?.map((v) => v.toJson()).toList();
    }
    map['user_id'] = _userId;
    map['sub_user'] = _subUser;
    map['created_at'] = _createdAt;
    map['updated_at'] = _updatedAt;
    map['schedule_count'] = _scheduleCount;
    return map;
  }
}

/// name : "comandroidcamera2_Screenshot_20220811_144229.png"
/// url : "https://file.pintreel.com/api/media/medias/c283d58a813bcd84fb08f224e0144875"
/// size : "16210"
/// uid : 1690955968826
/// status : "success"

class AttachmentsModel {
  AttachmentsModel({
    String? name,
    String? url,
    String? size,
    int? uid,
    String? status,
  }) {
    _name = name;
    _url = url;
    _size = size;
    _uid = uid;
    _status = status;
  }

  AttachmentsModel.fromJson(dynamic json) {
    _name = json['name'];
    _url = json['url'];
    _size = json['size'];
    _uid = json['uid'];
    _status = json['status'];
  }
  String? _name;
  String? _url;
  String? _size;
  int? _uid;
  String? _status;
  AttachmentsModel copyWith({
    String? name,
    String? url,
    String? size,
    int? uid,
    String? status,
  }) =>
      AttachmentsModel(
        name: name ?? _name,
        url: url ?? _url,
        size: size ?? _size,
        uid: uid ?? _uid,
        status: status ?? _status,
      );
  String? get name => _name;
  String? get url => _url;
  String? get size => _size;
  int? get uid => _uid;
  String? get status => _status;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['name'] = _name;
    map['url'] = _url;
    map['size'] = _size;
    map['uid'] = _uid;
    map['status'] = _status;
    return map;
  }
}
